import $ from "../jquery-3.4.1.min.js";
import ajax from "../../utils/ajsx.js";
const token = localStorage.token;
if (token) {
    $.ajaxSetup({
        headers: {
            'Authorization': token
        },
        error(err) {
            if (err.status == 401) {
                alert('登录已过期，请重新登录');
                location.href = "../login.html";
            }
        }
    })
    
} else {
    alert("未登录");
    location.href = "../../login.html";
}

$.ajax({
    url: "http://192.168.13.6:8000/PropertyUser/getUser",
    type: 'post',
    success(res) {
        if(res.code){
            console.log(res);
            localStorage.username = res.data._id;
            localStorage.user = res.data.username;
        }
    }
})